package com.jvup.gameshow.activity.interceptor;

import android.content.Context;

import com.jvup.common.constant.Navigation;
import com.jvup.common.model.entity.UserEntity;
import com.jvup.common.utils.ToastHelper;
import com.qire.antscore.annotation.InterceptorMapping;
import com.qire.antsrouter.AntsRouter;
import com.qire.antsrouter.card.FloorCard;
import com.qire.antsrouter.card.Postcard;
import com.qire.antsrouter.intercept.InterceptRules;
import com.qire.antsrouter.intercept.Interceptor;

@InterceptorMapping(group = Navigation.Group.UserGroup)
public class NotLoginIntercept implements InterceptRules {

    @Override
    public void process(Postcard postcard, Interceptor interceptor) {
        if(UserEntity.self.isLogin()) {
            interceptor.onNext();
        } else {
            AntsRouter.ROUTER.<FloorCard>buildCard(Navigation.Page.LoginGuidePage).navigation();
            interceptor.onInterrupt("未登录");
            ToastHelper.showToast("未登录，请先登录");
        }
    }

    @Override
    public void init(Context context) {

    }
}
